//
//  SystemTableViewCell.m
//
//  Created by 零零壹 on 2016/11/17.
//  Copyright © 2016年 零零壹. All rights reserved.
//

#import "SystemTableViewCell.h"

@implementation SystemTableViewCell

- (void)awakeFromNib {
    [super awakeFromNib];
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

-(instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        self.TitimageV = [[UIImageView alloc]init];
        [self.contentView addSubview:self.TitimageV];
        self.titL = [[UILabel alloc]init];
        self.titL.font = [UIFont systemFontOfSize:16];
        [self.contentView addSubview:self.titL];
        
        self.rightL = [[UILabel alloc]init];
        self.rightL.font = [UIFont systemFontOfSize:14];
        [self.contentView addSubview:self.rightL];
        
        self.BottomlineV = [[UIView alloc]init];
        self.BottomlineV.backgroundColor = UIColors(0xEFEFEF);
        [self.contentView addSubview:self.BottomlineV];
        
        self.lastImageV = [[UIImageView alloc]init];
        self.lastImageV.image = [UIImage imageNamed:@"arrow"];
        [self.contentView addSubview:self.lastImageV];
    }
    return self;
}

-(void)layoutSubviews
{
    [super layoutSubviews];
    [self.TitimageV mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(self.contentView.mas_left).offset(10);
        make.centerY.equalTo(self.contentView.mas_centerY);
        make.width.mas_equalTo(20);
        make.height.mas_equalTo(20);
    }];
    [self.titL mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(self.TitimageV.mas_right).offset(10);
        make.centerY.equalTo(self.contentView.mas_centerY);
    }];
    [self.rightL mas_makeConstraints:^(MASConstraintMaker *make) {
        make.right.equalTo(self.lastImageV.mas_left).offset(-10);
        make.centerY.equalTo(self.contentView.mas_centerY);
    }];

    if(self.lineV==false){
        [self.BottomlineV mas_makeConstraints:^(MASConstraintMaker *make) {
            make.left.equalTo(self.contentView.mas_left).offset(10);
            make.right.equalTo(self.contentView.mas_right);
            make.height.mas_equalTo(1);
            make.bottom.equalTo(self.contentView.mas_bottom);
        }];
    }else{
        [self.BottomlineV mas_makeConstraints:^(MASConstraintMaker *make) {
            make.left.equalTo(self.contentView.mas_left);
            make.right.equalTo(self.contentView.mas_right);
            make.height.mas_equalTo(1);
            make.bottom.equalTo(self.contentView.mas_bottom);
        }];

    }
    
    [self.lastImageV mas_makeConstraints:^(MASConstraintMaker *make) {
        make.right.equalTo(self.contentView.mas_right).offset(-10);
        make.centerY.equalTo(self.contentView.mas_centerY);
        make.width.mas_equalTo(20);
        make.height.mas_equalTo(20);
    }];
}

@end
